using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Publicuse.Entity.AttributeUtil;
using SqlSugar;

namespace Publicuse.Entity
{
  /// <summary>
  /// 数据字典管理
  /// </summary>
  [DBTable("`geeker-dictionaries`", " 数据字典信息")]
  [Table("`geeker-dictionaries`")]
  [SugarTable("`geeker-dictionaries`")]
  public class Dictionaries : BaseModel<long>
  {
    [Remark("字典类型")]
    public string dTypeName { get; set; }

    [Remark("字典名称")]
    public string dName { get; set; }
    
    [Remark("字典编码")]
    public string dCode { get; set; }

    [Remark("上级字典编码")]
    public string dParentcode { get; set; }

    [Remark("上级字典名称")]
    [SugarColumn(IsIgnore = true)]
    public string dParentName { get; set; }

    [Remark("字典值")]
    public string dValue { get; set; }

    public Dictionaries()
    {
      this.Id = 0;
    }
  }

  /// <summary>
  /// 数据字典查询参数
  /// </summary>
  public class DictionariesQuery : CommonQuery
  {
    public int dId { get; set; }
    public string dTypeName { get; set; }

    public string dName { get; set; }

    public string cTime { get; set; }

    public DictionariesQuery()
    {
      this.exportName = GetExportName;
      this.businessType = BusinessType.dictionaries;
    }

    public static string GetExportName
    {
      get { return "dictionaries"; }
    }
  }

    public class DictionariesTree
    {
        public string value { get; set; }
        public string label { get; set; }
        public List<DictionariesTree> children { get; set; }
    }
}
